﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Diagnostics;

namespace DataApplication
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            if (CheckExist())
            {
                MessageBox.Show("不能重复打开数据中心。");
                Application.Exit();
            }
            else
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new MainForm());
            }
        }

        

        private static Boolean CheckExist() //调用方法，传参
        {
            try
            {
                Process[] thisproc = Process.GetProcessesByName("DataApplication");
                return thisproc.Length > 1;
            }
            catch //出现异常，表明 kill 进程失败
            {
                return false;
            }
        }
    }



    public delegate void DataBaseMessageEvent(DaInterFace.MessageType type, String note, Double span);
    public delegate void MobileMessageEvent(DaInterFace.MessageType type, String note, Double span);
    public delegate void PDAMessageEvent(DaInterFace.MessageType type, String note, Double span);
    public delegate void SYNMessageEvent(DaInterFace.MessageType type, String note, Double span);
}
